Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP un-ignore application/Database/Migrations directory from .gitignore #1455

Conversation

samsonasik
Copy link
Member

When developer create a migration files, they can commit and share it with other developers. So, I think it should be removed from .gitignore.

Checklist:

  • Securely signed commits

@jim-parry
Copy link
Contributor

I think you are correct, but we then need to modify the migration testing so it doesn't generate a ton of migration files there, that remain behind and get propagated to the community. Maye it should be using VFS for the test files.

@samsonasik
Copy link
Member Author

@jim-parry I've updated test in tests/system/Command/SessionsCommandsTest.php in tearDown() function to remove php files under application/Database/Migrations directory.

@jim-parry
Copy link
Contributor

We'll give it a whirl :)

@jim-parry
Copy link
Contributor

Won't your change remove al the migrations in application/Database/Migrations?
I thought the purpose of this PR was to prevent that.
Do we not need to use VFS perhaps, for the migration testing, rather than letting them be created in application/,,,? Not sure how easy that is to do.

@samsonasik
Copy link
Member Author

samsonasik commented Nov 11, 2018

Yes, the current solution is run on tearDown() function that executed after each test. I'm not sure if using vps will be easy to do, or something in the service probably can be mocked for create migration file.

@jim-parry jim-parry changed the title un-ignore application/Database/Migrations directory from .gitignore WIP un-ignore application/Database/Migrations directory from .gitignore Nov 14, 2018
@samsonasik samsonasik force-pushed the unignore-database-migration-directory branch from ac95cc1 to b60cc35 Compare November 18, 2018 00:29
@samsonasik samsonasik force-pushed the unignore-database-migration-directory branch from b60cc35 to 9c73d4a Compare November 20, 2018 06:12
@samsonasik
Copy link
Member Author

@jim-parry I've updated the tests to only remove migration file that created via test so it won't remove another existing migration files if any.

@jim-parry
Copy link
Contributor

Looks like a good solution for now, thanks.
Long-term, we need to add some flexibility so that migrations for testing don't touch the application folder - but not today :-/

@jim-parry
Copy link
Contributor

I may have spoken too soon. Looking at the migration docs, migrations are created with a timestamp-based name if the "type" preference is "timestamp". That would create migrations starting with "2", eg. 20181119..., which is the set you git ignore. So we can't git ignore them :-/

@jim-parry
Copy link
Contributor

If SessionsCommandsTest deletes all the ones that it creates, we are good. Testing here.

@jim-parry
Copy link
Contributor

Oops - misread your change to .gitignore ... you don't keep them around. All is good :) and it tests fine.

@jim-parry jim-parry merged commit 35cf249 into codeigniter4:develop Nov 20, 2018
@samsonasik samsonasik deleted the unignore-database-migration-directory branch November 20, 2018 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants